const bookModel = require("../models/bookModel")

module.exports = {
  async list(req, res) {
    try {
      const listResult = await bookModel.list(req.query.current, req.query.pageSize)

      console.log("书籍列表成功：", listResult)

      res.json({
        errCode: "200",
        errMsg: "ok",
        data: listResult,
      })
    } catch (err) {
      console.log("书籍列表错误：", err)
      res.json({
        errCode: "1001",
        errMsg: "fail",
        err,
      })
    }
  },
  add(req, res) {},
}
